/////////////////////////////////////////////////////////////////
//
//
//		PROJECT	: futrue
//
//      FILE	: EncodeMgr.h
//
//		PURPOSE	: encode manager,create a real encoder with client init msg 
//
//		AUTHOR  : ax
//
//		DATE    : 2008/10/23
//
///////////////////////////////////////////////////////////////

// EncodeMgr

// This class is used internally by vncClient to offload the handling of
// bitmap data encoding and translation.  Trying to avoid bloating the
// already rather bloaty vncClient class!


#ifndef __ENCODE_MGR_H__
#define __ENCODE_MGR_H__

class BaseEncoder;
 
class EncodeMgr
{
public:
	// Create/Destroy methods
	EncodeMgr();
	~EncodeMgr();

	int  Create(int nEncoderType,const rfbServerInitMsg& tLocalFormat,
				const rfbServerInitMsg& tRemoteFormat);
	void  Destroy();

	unsigned int EncodeRect(BYTE* pszSrcBuf,BYTE* pszDestBuf,int nDestBufLen,const rfb::Rect &rect);

#if 0 //ax
	inline void SetBuffer(vncBuffer *buffer);
#endif

#if 0
	// BUFFER INFO
	inline rfb::Rect GetSize();
	inline BYTE *GetClientBuffer();
	inline UINT GetClientBuffSize() {return m_clientbuffsize;}; // sf@2002
	inline BOOL GetPalette(RGBQUAD *quadbuff, UINT ncolours);
#endif

#if 0 //ax
	inline omni_mutex& GetUpdateLock() {return m_buffer->m_desktop->GetUpdateLock();};


	// ENCODING & TRANSLATION
	inline UINT GetNumCodedRects(const rfb::Rect &rect);
	inline BOOL SetEncoding(CARD32 encoding,BOOL reinitialize);
	//inline UINT EncodeRect(const rfb::Rect &rect);
	inline UINT EncodeRect(const rfb::Rect &rect,VSocket *outconn);


	// Tight - CONFIGURING ENCODER
	inline void SetCompressLevel(int level);
	inline void SetQualityLevel(int level);
	inline void EnableLastRect(BOOL enable);
	inline BOOL IsLastRectEnabled() { return m_use_lastrect; }

	// CURSOR HANDLING
	inline BOOL SetServerFormat();
	inline BOOL SetClientFormat(rfbPixelFormat &format);
	inline rfbPixelFormat GetClientFormat() {return m_clientformat;};
	inline void SetSWOffset(int x,int y);
	// CURSOR HANDLING

	// CLIENT OPTIONS
	// CACHE HANDLING
	
	
	// sf@2005 - Grey palette
	inline void EnableGreyPalette(BOOL enable);

#endif	
#if 0//ax
	// QUEUE ZLIBXOR
	inline void LastRect(VSocket *outConn);

#endif

	// Modif cs@2005
#ifdef DSHOW
	inline BOOL ResetZRLEEncoding(void);
#endif

#if 0
	inline bool IsSlowEncoding() {return (m_encoding == rfbEncodingZRLE || m_encoding == rfbEncodingTight || m_encoding == rfbEncodingZlib);};
	inline bool IsUltraEncoding() {return (m_encoding == rfbEncodingUltra);};

#endif


protected:

 
	BaseEncoder             *m_pEncoder;
	

#if 0
	// cache handling
	BOOL			m_cache_enabled;
	int				m_SWOffsetx;
	int				m_SWOffsety;
#endif

public:
#if 0//ax
	vncBuffer	*m_buffer;
#endif
 
};
#endif 

